feat(cymbal): add typed frame resolution metrics#52057
Conversation
…ation Store FrameError directly on Frame instead of a string, enabling typed metric reasons (no_reference, no_symbol_set, symbol_not_found, network_error, invalid_data) without fragile string matching. Adds cymbal_frame_resolved and cymbal_frame_not_resolved counters with lang and reason labels, plus a warn log on resolution failures.
|
Use raw JSON extraction in handles_missing_sourcemap test to avoid losing resolve_failure during typed deserialization round-trip. Also fix rustfmt formatting in frame_error_serde.
cat-ph
left a comment
There was a problem hiding this comment.
I think a test is still failing but the approach looks great!
Problem
Cymbal lacked centralized metrics for frame resolution outcomes, making it hard to monitor resolution success rates and diagnose failure patterns (missing symbol sets, network errors, invalid data, etc.).
Changes
Option<FrameError>directly onFrameinstead of separateOption<String>+Option<&'static str>fields — the typed error provides both the human-readable message (viaDisplay) and a metric-friendly reason (viametric_reason())metric_reason()methods to all resolution error enums (JsResolveErr,HermesError,ProguardError,AppleError,FrameError) returning categorized labels:no_reference,no_symbol_set,symbol_not_found,network_error,invalid_datacymbal_frame_resolvedandcymbal_frame_not_resolvedcounters withlangandreasonlabels in the centralizedRawFrame::resolve()methodwarn!log on frame resolution failures with structuredlang,reason, anderrorfieldsClone,PartialEq,Eqderives toFrameErrorand all child error enums (+SymbolDataError) so they can live on theFramestructresolve_failurefield: serializesFrameErroras itsDisplaystring for backward-compatible JSON outputHow did you test this code?
cargo check -p cymbal --testspassesPublish to changelog?
no